<script setup lang="ts">
import { jump } from '@/utils/util'
withDefaults(
    defineProps<{
        list: any[]
    }>(),
    {
        list: () => []
    }
)

// const currentPage =
//获取当前路由
const currentPages = getCurrentPages()

const toTopciPage = (item: any) => {
    const currentPage = currentPages[currentPages.length - 1]
    const jumpURL = '/views/subViews/post/forumForTopic/index'
    console.log('/' + currentPage.route === jumpURL)
    if ('/' + currentPage.route === jumpURL) {
        return
    }
    jump(jumpURL + '?topicId=' + item.id)
}
</script>

<template>
    <view class="topic-list flex-wrap gap-[20rpx]">
        <view
            class="top-item"
            v-for="(item, index) in list"
            :key="index"
            @click.stop="toTopciPage(item)"
        >
            # {{ item.name }}</view
        >
    </view>
</template>

<style scoped lang="scss">
.topic-list {
    font-size: 12px;

    .top-item {
        background-color: #f7f7f7;
        border-radius: 999rpx;
        padding: 10rpx 10rpx;
        white-space: nowrap;
    }
}
</style>
